/* Copyright (c) 2009-2010, Sean A.O. Harney <sharney3@gmail.com> */

#include "omf.h"

//process `main` ASL
void asl_process_main(void)
{
    LLIST_P asl = asl_get_asl("main");
    asl_process_asl(asl);
}

void asl_process_asl_cell(struct st_asl_cell *asl_cell)
{
    if (asl_cell != NULL)
      {
	  debug2_printf("Processing ASL[%s]\n", asl_cell->symname);
	  asl_process_asl(asl_cell->asl);
    } else
	fprintf(stderr, "No ASL(s) to process\n");

}

void asl_process_asl(LLIST_P asl)
{
    LLIST_P walker;
    ASL_NODE_P stmt;

    if (asl != NULL)
      {
	  for (walker = asl; walker != NULL; walker = walker->next)
	    {
		stmt = walker->element;
		stmt_process(stmt);
	    }
    } else
	debug2_printf("ASL is empty\n");

}
